home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
man
/
cat.3
/
ExprLong.3
< prev
next >
Wrap
Text File
|
1995-07-25
|
8KB
|
133 lines
TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg((((3333)))) TTTTccccllll ((((7777....0000)))) TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg((((3333))))
_________________________________________________________________
NNNNAAAAMMMMEEEE
Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBool, Tcl_ExprString -
evaluate an expression
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
####iiiinnnncccclllluuuuddddeeee <<<<ttttccccllll....hhhh>>>>
int
TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg(_i_n_t_e_r_p, _s_t_r_i_n_g, _l_o_n_g_P_t_r)
int
TTTTccccllll____EEEExxxxpppprrrrDDDDoooouuuubbbblllleeee(_i_n_t_e_r_p, _s_t_r_i_n_g, _d_o_u_b_l_e_P_t_r)
int
TTTTccccllll____EEEExxxxpppprrrrBBBBoooooooolllleeeeaaaannnn(_i_n_t_e_r_p, _s_t_r_i_n_g, _b_o_o_l_e_a_n_P_t_r)
int
TTTTccccllll____EEEExxxxpppprrrrSSSSttttrrrriiiinnnngggg(_i_n_t_e_r_p, _s_t_r_i_n_g)
AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
Tcl_Interp *_i_n_t_e_r_p (in) Interpreter in whose
context to evaluate
_s_t_r_i_n_g.
char *_s_t_r_i_n_g (in) Expression to be
evaluated. Must be in
writable memory (the
expression parser makes
temporary modifications
to the string during
parsing, which it
undoes before
returning).
long *_l_o_n_g_P_t_r (out) Pointer to location in
which to store the
integer value of the
expression.
int *_d_o_u_b_l_e_P_t_r (out) Pointer to location in
which to store the
floating-point value of
the expression.
int *_b_o_o_l_e_a_n_P_t_r (out) Pointer to location in
which to store the 0/1
boolean value of the
expression.
_________________________________________________________________
Page 1 (printed 7/10/95)
TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg((((3333)))) TTTTccccllll ((((7777....0000)))) TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg((((3333))))
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
These four procedures all evaluate an expression, returning
the result in one of four different forms. The expression
is given by the _s_t_r_i_n_g argument, and it can have any of the
forms accepted by the eeeexxxxpppprrrr command. The _i_n_t_e_r_p argument
refers to an interpreter used to evaluate the expression
(e.g. for variables and nested Tcl commands) and to return
error information. _I_n_t_e_r_p->_r_e_s_u_l_t is assumed to be
initialized in the standard fashion when any of the
procedures are invoked.
For all of these procedures the return value is a standard
Tcl result: TTTTCCCCLLLL____OOOOKKKK means the expression was succesfully
evaluated, and TTTTCCCCLLLL____EEEERRRRRRRROOOORRRR means that an error occurred while
evaluating the expression. If TTTTCCCCLLLL____EEEERRRRRRRROOOORRRR is returned then
_i_n_t_e_r_p->_r_e_s_u_l_t will hold a message describing the error. If
an error occurs while executing a Tcl command embedded in
the expression then that error will be returned.
If the expression is successfully evaluated, then its value
is returned in one of four forms, depending on which
procedure is invoked. TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg stores an integer value
at *_l_o_n_g_P_t_r. If the expression's actual value is a
floating-point number, then it is truncated to an integer.
If the expression's actual value is a non-numeric string
then an error is returned.
TTTTccccllll____EEEExxxxpppprrrrDDDDoooouuuubbbblllleeee stores a floating-point value at *_d_o_u_b_l_e_P_t_r.
If the expression's actual value is an integer, it is
converted to floating-point. If the expression's actual
value is a non-numeric string then an error is returned.
TTTTccccllll____EEEExxxxpppprrrrBBBBoooooooolllleeeeaaaannnn stores a 0/1 integer value at *_b_o_o_l_e_a_n_P_t_r.
If the expression's actual value is an integer or floating-
point number, then TTTTccccllll____EEEExxxxpppprrrrBBBBoooooooolllleeeeaaaannnn stores 0 at *_b_o_o_l_e_a_n_P_t_r
if the value was zero and 1 otherwise. If the expression's |
actual value is a non-numeric string then it must be one of |
the values accepted by TTTTccccllll____GGGGeeeettttBBBBoooooooolllleeeeaaaannnn, such as ``yes'' or |
``no'', or else an error occurs.
TTTTccccllll____EEEExxxxpppprrrrSSSSttttrrrriiiinnnngggg returns the value of the expression as a
string stored in _i_n_t_e_r_p->_r_e_s_u_l_t. If the expression's actual |
value is an integer then TTTTccccllll____EEEExxxxpppprrrrSSSSttttrrrriiiinnnngggg converts it to a |
string using sssspppprrrriiiinnnnttttffff with a ``%d'' converter. If the |
expression's actual value is a floating-point number, then |
TTTTccccllll____EEEExxxxpppprrrrSSSSttttrrrriiiinnnngggg calls TTTTccccllll____PPPPrrrriiiinnnnttttDDDDoooouuuubbbblllleeee to convert it to a |
string.
KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
boolean, double, evaluate, expression, integer, string
Page 2 (printed 7/10/95)